﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace NuMvvm.Services
{
    public class FrameWindow : Window
    {
        public FrameWindow()
        {
            RootFrame = new Frame();
            Content = RootFrame;
        }

        public static Frame RootFrame
        {
            get;
            private set;
        }

        public Uri StartupUri
        {
            get
            {
                return (Uri)GetValue(StartupUriProperty);
            }

            set
            {
                SetValue(StartupUriProperty, value);
            }
        }

        public static readonly DependencyProperty StartupUriProperty = DependencyProperty.Register("StartupUri", typeof(Uri), typeof(FrameWindow), new PropertyMetadata(null, StartupUriProperty_PropertyChanged));

        private static void StartupUriProperty_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RootFrame.Source = e.NewValue as Uri;
        }
    }
}
